package com.qqtop10.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qqtop10.manager.dao.RoleMapper;
import com.qqtop10.manager.model.PagingArgs;
import com.qqtop10.manager.model.Perm;
import com.qqtop10.manager.model.Role;
import com.qqtop10.manager.service.RoleService;

@Service("RoleService")
public class RoleServiceImpl extends BaseService implements RoleService {
	
	@Autowired
	private RoleMapper roleMapper;
	
	@Override
	public List<Role> all(Role input, PagingArgs pagingArgs) {
		return roleMapper.all(asMap(input, pagingArgs));
	}
	@Override
	public List<Perm> allPerm(Perm input, PagingArgs pagingArgs){
		return roleMapper.allPerm(asMap(input, pagingArgs));
	}
	
	@Override
	public int count(Role input) {
		try {
			return roleMapper.count(input);
		} catch (Exception e) {
			return 0;
		}
	}
	
	@Override
	public int delete(int id) {
		return roleMapper.delete(id);
	}

	@Override
	public int update(Role input) {
		return roleMapper.update(input);
	}

	@Override
	public int insert(Role input) {
		return roleMapper.insert(input);
	}

	@Override
	public Role selectById(int id) {
		return roleMapper.selectById(id);
	}
}
